package com.example.killer.adapterdemo;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.Adapter;
import android.widget.ArrayAdapter;
import android.widget.ListView;

import java.util.ArrayList;

public class MainActivity extends AppCompatActivity {

    ListView listView;
    private ArrayList<String> values;
    private ArrayAdapter adapter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        listView = (ListView) findViewById(R.id.lv_list);

        values = new ArrayList<>();
        for(int i = 0;i<30;i++){
            values.add("标题"+i);
        }

        adapter = new ArrayAdapter(this,android.R.layout.simple_list_item_1,values);
        listView.setAdapter(adapter);
    }
}
